package com.huilian.iotbox.data.enums;

import lombok.Getter;

import java.util.stream.Stream;

/**
 * 终端权限类型
 */
@Getter
public enum PermissionPlatformTypeEnum {
    PC_WEB_PAGE(1, "PC网页"),
    MERCHANT_APPLET(2, "商户小程序"),
    CASHIER_DESK(3, "收银桌面端"),
    HAND_SIDE_OF_THE_CASHIER(4, "收银手持端"),;

    private Integer code;
    private String desc;

    PermissionPlatformTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PermissionPlatformTypeEnum getPlatformType(Integer code) {
        return Stream.of(PermissionPlatformTypeEnum.values())
                .filter(p -> p.code.equals(code))
                .findAny()
                .orElse(null);
    }
}
